package com.bergliege.subject.application.controller;

import com.bergliege.subject.application.dto.SubjectCategoryDTO;
import com.bergliege.subject.common.entity.Result;
import com.bergliege.subject.infra.basic.entity.SubjectCategory;
import com.bergliege.subject.infra.basic.service.SubjectCategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class SubjectController {

    @Resource
    private SubjectCategoryService subjectCategoryService;

    @GetMapping("/test")
    public String test(){
        SubjectCategory subjectCategory = subjectCategoryService.queryById(1L);
        return subjectCategory.getCategoryName();
    }
    @GetMapping("/ctrl")
    public Result<Boolean> ctrl(){
        SubjectCategory subjectCategory = subjectCategoryService.queryById(1L);
         int isDel = subjectCategory.getIsDeleted();
         if (isDel == 1) {
             return Result.ok(true);
         }else {
             return Result.ok(false);
         }

    }
}
